package com.chenwei.design.proxy.cglib;

/**
 * @author: chenwei
 * @date: 2021/3/28 18:20
 */
public class Client {
    public static void main(String[] args) {
        //1.创建目标对象
        CglibTargetObject target = new CglibTargetObject();

        //2.获取代理对象
        CglibTargetObject proxyInstance = (CglibTargetObject) new CglibProxyFactory(target).getProxyInstance();

        //3.执行代理对象的方法，触发intecept 方法，从而实现 对目标对象的调用
        String hello = proxyInstance.say("代理让我说helle");
        System.out.println(hello);

        System.out.println("------");
        proxyInstance.work();
    }
}
